<?php
$chart = new RM_Chart_Unit_Perfomance();
$jsonData = $chart->getData();
$json = '{"fields":'.Zend_Json::encode($jsonData->fields).',"series":'.Zend_Json::encode($jsonData->series).',"data":'.Zend_Json::encode($jsonData->data).'}';
?>

<b>Unit Rentals for Last 12 Months</b><br/>
<div id="rm_chart_render_area">

</div>

<script type="text/javascript">

var jsonData = <?php echo $json;?>;

var series = jsonData.series;

var chartstore = new Ext.data.JsonStore({
    fields: jsonData.fields,
    data: jsonData.data,
    autoLoad: true
});

new Ext.chart.LineChart({
    id: 'rm_reports_module_unit_rentals_chart',
    xtype: 'linechart',
    renderTo: 'rm_chart_render_area',
    store: chartstore,
    xField: 'date',
    width: 800,
    height: 400,
    bodyBorder : false,
    xAxis: new Ext.chart.CategoryAxis({
        title: 'Month'
    }),
    yAxis: new Ext.chart.NumericAxis({
        title: 'Reservations'
    }),
    chartStyle: {
        animationEnabled: true,
        xAxis: {
            labelRotation: -90
       }
    },
    series: series,
    dataTip: {
        padding: 5,
        border: {
            color: 0x99bbe8,
            size:1
        },
        background: {
            color: 0xDAE7F6,
            alpha: .9
        },
        font: {
            name: 'Tahoma',
            color: 0x15428B,
            size: 10,
            bold: true
        }
    }
});

Ext.getCmp('rm_reports_run_button_print').disable();

</script>